<?php

use yii\db\Migration;

class m240417_014729_diandi_hotel_list extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%diandi_hotel_list}}', [
            'id' => "int(11) NOT NULL AUTO_INCREMENT",
            'bloc_id' => "int(11) NULL COMMENT '公司ID'",
            'store_id' => "int(11) NULL COMMENT '商家ID'",
            'name' => "varchar(255) NULL DEFAULT '' COMMENT '酒店名称'",
            'lng' => "decimal(10,2) NULL COMMENT '经度'",
            'lat' => "decimal(10,2) NULL COMMENT '维度'",
            'is_show' => "int(11) NULL COMMENT '是否公开'",
            'address_show' => "int(11) NULL COMMENT '是否公开地址'",
            'type' => "int(11) NULL COMMENT '房源类型'",
            'address' => "varchar(255) NULL DEFAULT '' COMMENT '具体地址'",
            'location_p' => "int(11) NULL DEFAULT '0' COMMENT '省份'",
            'location_c' => "int(11) NULL DEFAULT '0' COMMENT '城市'",
            'location_a' => "int(11) NULL DEFAULT '0' COMMENT '区县'",
            'roomcount' => "int(11) NULL DEFAULT '0' COMMENT '房间总量'",
            'status' => "int(11) NULL DEFAULT '0' COMMENT '酒店状态'",
            'phone' => "varchar(255) NULL DEFAULT '' COMMENT '联系电话'",
            'mail' => "varchar(255) NULL DEFAULT '' COMMENT '联系邮箱'",
            'thumb' => "varchar(255) NULL DEFAULT '' COMMENT '酒店图片'",
            'description' => "text NULL COMMENT '酒店简介'",
            'content' => "text NULL COMMENT '酒店介绍'",
            'traffic' => "text NULL COMMENT '周边交通'",
            'thumbs' => "text NULL COMMENT '酒店相册'",
            'sales' => "text NULL",
            'displayorder' => "int(11) NULL DEFAULT '0' COMMENT '排序'",
            'comment_num' => "int(11) NULL COMMENT '评价数量'",
            'comment_start' => "decimal(11,2) NULL COMMENT '评价星级'",
            'level' => "int(11) NULL DEFAULT '0' COMMENT '酒店星级'",
            'device' => "text NULL COMMENT '服务设施'",
            'brandid' => "int(11) NULL DEFAULT '0' COMMENT '所属品牌'",
            'language' => "tinyint(4) NOT NULL DEFAULT '0' COMMENT '语言类型标志/默认中文0'",
            'landlord_id' => "int(11) NULL COMMENT '房东ID'",
            'create_time' => "datetime NULL",
            'update_time' => "datetime NULL",
            'PRIMARY KEY (`id`)'
        ], "ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='酒店主表'");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%diandi_hotel_list}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

